#Lteral tuples
t  =  ("Norway",  4.953,  3)
t

#tuple element access
t[0]
t[2]

#The length of a tuple
len(t)

#Iterating over a tuple
for item in t:
    print(item)

#Concatenating and repetition of tuples
t + (338186.0, 265E9)
t * 3

#Nested tuples
a  =  ((220,  284),  (1184,  1210),  (2620,  2924),  (5020,  5564),  (6232,  6368))

a[2][1]

#Single-element tuples
h = (391)
h
type(h)

k = (391,)
k
type(k)


#Empty tuples
e = ()
e
type(e)


#Optional parentheses
p  =  1,  1,  1,  4,  6,  19
p
type(p)


#Returning and unpacking tuples
def minmax(items):
    return min(items), max(items)

minmax([83,  33,  84,  32,  85,  31,  86])

lower,  upper  =  minmax([83,  33,  84,  32,  85,  31,  86])
lower
upper

(a,  (b,  (c,  d)))  =  (4,  (3,  (2,  1)))
a
b
c
d


#Swapping variables with tuple unpacking
a = 'jelly'
b  =  'bean'
a, b = b, a
a
b


#The tuple constructor
tuple([561,  1105,  1729,  2465])
tuple("Carmichael")


#Membership tests
5  in (3,  5,  17,  257,  65537)
5  not in (3,  5,  17,  257,  65537)
